*     *****************************************************************   *;
*     *****************************************************************   *; 
*   Date:          December 27, 2021                               	      *;
*   Authors:       Lisa Dellmuth and Jonas Tallberg				          *;   
*   Purpose: 	   Analyses for book Legitimacy Politics: Elite  		  *;
*    Communication and Public Opinion in Global Governance (CUP, 2023)    *;
*     ****************************************************************    *;
*     ****************************************************************    *;



*Figure 2.7

use "Leggov elite survey 19 sept 2019.dta", clear

label define countries 1 "Global" 2 "Brazil" 3 "Philippines" 4 "Germany" 5 "South Africa" 6 "USA" 7 "Russia", modify
label values country countries
tab country
recode country 3=4 4=3 5=6 7=5 6=7
label define countries 1 "Global" 2 "Brazil" 3 "Germany" 4 "Philippines" 5 "Russia" 6 "South Africa" 7 "US", modify
label values country countries
tab country

sum confUN-confFIFA
recode confUN 1=0 2=0 3=1 4=1
recode confIMF 1=0 2=0 3=1 4=1
recode confICC 1=0 2=0 3=1 4=1
recode confNATO 1=0 2=0 3=1 4=1
recode confWB 1=0 2=0 3=1 4=1
recode confWHO 1=0 2=0 3=1 4=1
recode confWTO 1=0 2=0 3=1 4=1
recode confUNFCCC 1=0 2=0 3=1 4=1
recode confUNSC 1=0 2=0 3=1 4=1
recode confG20 1=0 2=0 3=1 4=1
recode confAU 1=0 2=0 3=1 4=1
recode confEU 1=0 2=0 3=1 4=1
recode confASEAN 1=0 2=0 3=1 4=1
recode confNAFTA 1=0 2=0 3=1 4=1
recode confMERCOSUR 1=0 2=0 3=1 4=1
recode confSCO 1=0 2=0 3=1 4=1
recode confgov 1=0 2=0 3=1 4=1

set scheme plotplain

collapse confUN-confG20 confgov, by(country) 

egen confios = rowmean(confUN-confG20) // ignores missings
drop confUN-confG20

reshape long conf, i(country) j(inst, string)
replace inst="Gov." if inst=="gov"
replace inst="IOs" if inst=="ios"

drop if inst=="Gov."

graph bar conf, over(country, sort(conf) descending) ///
ylabel(0 "0%" .20 "20%" .40 "40%" .60 "60%" .80 "80%", labsize(small) angle(horizontal) ///
glcolor(gs14) gmax) bar(3, color(g2)) ytitle("% quite a lot or a great deal of confidence") ylabel(,gstyle(minor)) legend(off) 


